Zadig 文档
Zadig
教程
博客
论坛
关于
中文英文
Zadig
教程
博客
论坛
关于
Zadig v4.2
Loading...
     编辑文档
     反馈问题
     社区讨论

    本页导航

    Build Configuration

    Zadig build supports operations such as pulling code, compiling code, building Docker images/APK packages/Tar packages, pushing images, and uploading to object storage. It comes with common build environments and software packages and supports build caching.

    Create a build
    • Supports configuring multiple builds for a service, and select on demand in the workflow configuration. For more details, please refer to Workflow - Build task configuration
    • It supports multiple services using the same build configuration. For more details, please refer to Shared Build
    • Supports modifying the generation rules for building deliverables. For more details, please refer to Build deliverable generation rules

    Preparation

    Clearly identify the dependencies required for the build, including but not limited to:

    • Service compilation code dependencies (such as dependencies on Base libraries, open-source libraries, etc.)
    • Service compilation environment dependencies (such as Go version, Node version, compilation tools, etc.)
    • Service compilation system dependencies (such as operating systems, etc.)

    # Basic Configuration

    Build General Configuration

    Parameter Description:

    • Build Name: Customize it to be meaningful and easy to understand
    • Service Selection: Select the service to use this build configuration

    # Build Environment

    Configure the environment for the build process, supporting both Kubernetes and host infrastructure.

    Create a build

    # Using Kubernetes

    The build process runs in a K8s Pod, and you can configure operating system and software package dependencies.

    • Operating System: The platform provides by default Ubuntu 18.04 / Ubuntu 20.04 as the basic build system, it supports adding custom images as the build operating system, refer to Build image management
    • Dependencies Software Package: Various software package tools needed during the build process, such as different versions of Java, Go, Govendor, Node, Bower, Yarn, Phantomjs, etc.

    Tip

    1. The default Ubuntu series build systems provided by the platform already support the following tools/commands, which can be used directly in Software Package Management and build scripts:
      • build-essential / cmake / curl / docker / git
      • libfontconfig / libfreetype6-dev / libpcre3-dev / librrd-dev / libsasl2-dev
      • netcat-openbsd / pkg-config / python / tar / wget
    2. When selecting software packages, pay attention to the installation dependencies. The system will install them in the order of selection. For example: Govendor depends on Go, so please select Go first, then Govendor
    3. The platform has already built in some common software packages. If there are other software packages or version requirements, the system administrator can configure their installation scripts in Software Package Management

    # Using Host

    Execute build steps on the selected host, and the required software, tools, etc., can be installed in advance on the host.

    # Code Information

    Create a build

    Parameter Description:

    • Code Source: The platform where the code base is located. Please refer to Code Source Information for supported code sources
    • Code Repository Owner: Supports configuring all code repository owners under integrated code sources
    • Code Repository Name: The name of the code repository
    • Default Branch: The default branch selected when executing workflow configuration build variables, which can be modified during execution
    • Remote name: Specifies the name of the remote code repository, default origin
    • Clone Directory Name: Defines the directory name after the code repository is cloned, defaulting to the name of the code repository
    • Submodule: Synchronizes the code repositories configured in submodule
    • Pull Specific Commit: When enabled, supports selecting a specific Commit to execute when running the workflow
    • Display when executing: On by default. If set to off, the code repository option will not be displayed when executing the workflow, and the code configuration will use the default value

    The working directory structure is as follows:

    ├── $WORKSPACE         # The root directory of the build task
        ├── repository 1   # The first code repository
        ├── repository 2   # The second code repository
           ├── code       # The code in the second code repository
           └── ...
        └── ...
    
    1
    2
    3
    4
    5
    6

    Where:

    • $WORKSPACE is the built-in variable of the Zadig system build module, for a more detailed description, refer to System built-in environment variables

    # Build Variables

    Includes both system-built-in build variables and user-defined build variables, which can be used directly in the build script.

    Tip: Add env commands to Build script to view all build variables.

    Create a build

    Built-in Build Variables

    Built-in variables and their descriptions are as follows:

    Variable NameDescription
    WORKSPACECurrent workflow working directory
    WORKFLOWWorkflow ID for executing the build
    PROJECTProject ID
    TASK_IDThe ID of the current workflow task, i.e., the task sequence number
    IMAGEThe image name generated by the system according to the built-in rules is used for deployment updates of container services. The naming rules can be modified in the service's Policy configuration
    PKG_FILEThe system can modify the naming rules of the delivery file name generated by the built-in rules, and can modify its naming rules in the service's Policy configuration
    SERVICE_NAMEThe name of the built service
    SERVICE_MODULEThe name of the built service component
    TASK_URLThe URL of the build task
    CIThe value is always true and can be used as needed, such as to determine if it is a CI script or another script
    ZadigThe value is always true and can be used as needed, such as to determine if it is being executed in the Zadig system
    REPONAME_<index>1. Get the code repository name of the specified <index>
    2. <index> is the position of the code in the build configuration, with an initial value of 0
    3. In the following example, using $REPO_0 in the build script will get the name of the first code repository voting-app
    REPO_<index>1. Get the code repository name of the specified <index> and automatically replace the hyphen - in the name with an underscore _
    2. <index> is the position of the code in the build configuration, with an initial value of 0
    3. In the following example, using $REPO_0 in the build script will get the converted name of the first code repository voting_app
    <REPO>_PR1. Get the Pull Request information used for the specified <REPO> during the build process. When using, please replace <REPO> with the specific code repository name
    2. When the <REPO> information contains a hyphen -, replace - with an underscore _
    3. In the following example, to get the Pull Request information for the voting-app repository, use $voting_app_PR or eval PR=\${${REPO_0}_PR}
    4. If multiple PRs are specified during the build, such as PR IDs 1, 2, 3, the value of the variable will be 1,2,3
    5. When the code repository is from the other code source, this variable is not supported
    <REPO>_BRANCH1. Get the branch information used for the specified <REPO> during the build process. When using, please replace <REPO> with the specific code repository name
    2. When the <REPO> information contains a hyphen -, replace - with an underscore _
    3. In the following example, to get the branch information for the voting-app repository, use $voting_app_BRANCH or eval BRANCH=\${${REPO_0}_BRANCH}
    <REPO>_PRE_MERGE_BRANCHES1. Pre-merge branches when running multi-branch merge builds; <REPO> is the specific repository name and can be provided directly or combined with the $<REPO_INDEX> variable
    2. If <REPO> contains a hyphen -, replace it with an underscore _
    3. For example, use eval BRANCH=\${${REPO_0}_PRE_MERGE_BRANCHES} to get the pre-merge branch info for the first repository
    <REPO>_TAG1. Get the Tag information used for the specified <REPO> during the build process. When using, please replace <REPO> with the specific code repository name
    2. When the <REPO> information contains a hyphen -, replace - with an underscore _
    3. In the following example, to get the Tag information for the voting-app repository, use $voting_app_TAG or eval TAG=\${${REPO_0}_TAG}
    <REPO>_COMMIT_ID1. Get the Commit ID information used for the specified <REPO> during the build process. When using, please replace <REPO> with the specific code repository name
    2. When the <REPO> information contains a hyphen -, replace - with an underscore _
    3. In the following example, to get the Commit ID information for the voting-app repository, use $voting_app_COMMIT_ID or eval COMMIT_ID=\${${REPO_0}_COMMIT_ID}
    4. When the code repository is from the other code source, this variable is not supported
    <REPO>_ORG1. Get the organization/user information used for the specified <REPO> during the test process. When using, please replace <REPO> with the specific code repository name
    2. When the <REPO> information contains a hyphen -, replace - with an underscore _
    3. In the following example, to get the organization/user information for the voting-app repository, use $voting_app_ORG or eval ORG=\${${REPO_0}_ORG}
    Create a build

    Custom Build Variables

    Explanation:

    • Supports string (single-line/multi-line), single-choice, multiple-choice, file, and dynamic variable types
    • You can set string-type variables as sensitive information, and the value of sensitive variables will not be output in the build log of the workflow task
    • When executing workflow tasks, you can modify the values of custom build variables to override the default values configured here, as shown in the figure below:
    Modify build variables when running a workflow

    # Build Script

    Declare the build process and implementation in the build script.

    Build variables can be used in build scripts

    Create a build

    # Advanced Configuration

    Advanced configuration

    Explanation:

    • Policy Configuration: Configure the timeout time for the build service. If the build is not successful after the set time threshold, it will be considered a timeout failure
    • Cache Configuration: After caching is enabled, the cache directory configured here will be used when the workflow is executed. The directory configuration can use Build variables
    • Cluster Selection: Select the cluster resource to be used when the build task runs, where the local cluster refers to the cluster where the Zadig system is located. For cluster integration, refer to Cluster Management
    • Operating System Specification: Configure resource specifications for performing build tasks. The platform provides four configurations for High/Medium/Low/Lowest. In addition, you can also customize according to actual needs. If you need to use GPU resource, resource configuration form is vendorname.com/gpu:num, please refer to Scheduling GPU(opens new window) for more information
    • Scheduling Policy: Select the cluster scheduling policy, and the default is Random Scheduling policy. Please refer to Set scheduling policy management
    • Mount Storage: Mount persistent storage for build tasks, supports configuring storage type, storage size and mount path, can be used for storing build artifacts and other scenarios
    • Use Host Docker daemon: After enabling, the Docker daemon on the node where the container is located will be used during the build execution process to perform Docker operations
    • Privileged: After enabling, the container in the Pod will run in privileged mode. This is suitable for build scenarios that require running Docker inside the container or need higher system permissions. Note: Privileged mode has certain security risks and is only recommended in trusted environments
    • Task Labels: Configure the Pod resource tags for the build task execution
    • Task Annotations: Configure the Pod resource annotations for the build task execution
    • Output Variables: Output the environment variables in the build, which can realize the variable transfer between different tasks in the workflow, refer to Variable passing

    # More Build Steps

    In Add Steps, you can add more build steps as needed.

    Add more build steps

    Image Building

    Build the image according to the configured parameters, using the built-in variable IMAGE as the name of the built image, and push it to the image repository.

    Parameter Description:

    • Build Context Directory: The directory where the execution docker build is located
    • Dockerfile Source: Includes Code Repository and Template Library. For more information on the template library, see Dockerfile Template Management
    • Dockerfile Absolute Path: When Dockerfile originates from the code base, specify the Dockerfile path used to execute docker build
    • Template Selection: When the Dockerfile originates from the template library, select the specific Dockerfile template
    • Build Parameters: All parameters that support docker build, such as: --build-arg key1=value1 --build-arg key2=value2
    • BuildKit Build: After enabling, supports multi-platform builds, improving build efficiency and compatibility.

    Among the above parameters, except Dockerfile Source and Template Selection, Variables can be used for all other parameters.

    Binary Package Storage

    Configure the storage path for the built binary package.

    File Storage

    Upload the specified file to the object storage. After uploading, the file will be stored in the specified directory of the corresponding bucket in the object storage. The directory here can use Variables, but it does not support nested variables, such as ${$REPO_0}_BRANCH.

    • Upload specified file: configure the specified file path, such as infra/result.xml in the figure above
    • Upload all files in the directory (excluding subdirectories): configure the specified directory, such as infra/examples/ in the figure above

    Shell Script Execution

    Add a Shell script execution step to perform certain operations after the build.

    ← Environment SleepMulti-Service Shared Build→

    资源
    教程
    论坛
    博客
    公司
    关于
    客户故事
    加入我们
    联系我们
    微信扫一扫
    hello@koderover.com

    © 2026 筑栈(上海)信息技术有限公司 沪 ICP 备 19000177 号 - 1

    •  跟随系统
    •  浅色模式
    •  深色模式
    •  阅读模式